home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Free Software Collection: Marty 1
/
FM Towns Marty 1 Free Software Collection.iso
/
game
/
s_box1
/
s_box1.bas
< prev
next >
Wrap
BASIC Source File
|
1993-11-11
|
30KB
|
897 lines
10000 'スライドボックス タイプ1 Ver1.0 L20A '1993.4.4
10010 *COMENT
10020 '
10030 'SETX,SETY X,Yが、長い式で表される時、始めに計算しておく。
10040 'Box(X,Y) 座標X,YのBOXの色 1<=X<=MaxX, 1<=Y<=MaxY
10050 'CBox(x,y) complete(完成)の絵
10060 'Men 面
10070 'LastMen 面総数=最終面
10080 'Men$ 面データ
10090 'Mode モード パズル・・0,タイムトライアル・・1,面エディット・・-1
10100 'Lv レベル Easy・・0, Normal・・1, Hard・・2
10110 'byte2 BOX1つのイメ-ジに必要な配列要素数 (int=2bytes)
10120 'GetImage BOXのイメ-ジ格納変数
10130 'Ofset オフセット
10140 'Q$ キー入力
10150 'ST ステップ小さいほどウエイトが掛かる
10160 'TMP テンポラリ変数
10170 '変数一覧
10180 'X,Y BOXの位置
10190 'MX,MY マウスカーソルのBOX座標
10200 'XX,YY カ-ソルの向き
10210 'MaxX,MaxY BOXの枠の幅
10220 'NowX,NowY 現在の空白地
10230 'NextX,NextY 次の空白地
10240 'BXY BOXの大きさ BXY<=40,BXY=ST*n,BXY=ST*n
10250 'CBX,CBY
10260 'TX,TY BOXのSET位置
10270 'CTX,CTY
10280 'MOVE BOXの動く向き MOVE=1 or -1
10290 'RET BOXを戻すか戻さないか RET=TRUE or FALSE
10300 'MUS マウスを使用する MUS=TRUE /しない MUS=FALSE
10310 '************************ 書式 *******************************
10320 'line (x1,y1)-(x2,y2),pset,%n,bf
10330 'palette n,[G,R,B]
10340 'get@a(x1,y1)-(x2,y2),getimage,byte2*i
10350 'put@a(x1,y1)-(x2,y2),getimage,/pset,preset,or,and,xor/,,,ofset
10360 '*********************** 諸設定 ******************************
10370 '
10380 *SETTING
10390 COLOR 7,0,7,4
10400 CLS : DEFINT A-Z : SCREEN@ 0 'color 8/4096 mode...default
10410 TRUE=(1=1): FALSE=NOT TRUE:MOVE=1
10420 RANDOMIZE(TIME)
10430 BXY=40 'bxy の最大値
10440 BYTE2=INT((INT((BXY+7)/8)*BXY*4+4-1)/4)*2
10450 DIM GETIMAGE(BYTE2*16)
10460 DIM GAMEN(76800) :GOSUB *GETGAMEN
10470 DIM G(15),R(15),B(15)
10480 RESTORE *SETCOLOR
10490 FOR I=0 TO 15
10500 READ G(I),R(I),B(I)
10510 'PALETTE I,[G(I),R(I),B(I)]
10520 NEXT I
10530 DIM BOX(20,20),CBOX(20,20)
10540 DIM HS&(1,2)
10550 '
10560 BXY=40:ST=4 'BXY=ST*X BXY<=40
10570 LASTMEN=5 :COL=0
10580 MODE=0 :LV=0:MEN=1
10590 IF NOT MODE THEN FOR I=1 TO 15:PALETTE I,0:NEXT I
10600 '******************** メインルーチン *************************
10610 GOSUB *USEMOUSE 'マウスを使用するかどうか決定
10620 IF MODE THEN F$="ptn24":GOSUB *GETTING'グラフィックパターンの読み取り
10630 *TITLE
10640 CLS 1 'text clear
10650 MEN=1:SC&=0:TOTAL=0
10660 IF MUS AND (NOT MODE) THEN MOUSE 1,,,0
10670 IF NOT MODE THEN GOSUB *MENU
10680 *MAIN
10690 IF MUS AND (NOT MODE) THEN MOUSE 1,,,0
10700 IF NOT MODE THEN GOSUB *READING '余分なデータの読み飛ばし
10710 IF MODE=-1 THEN GOTO *EDITTING
10720 GOSUB *SHOW '面データの読み込みと表示
10730 *START
10740 'IF MODE=1 THEN GOSUB *SHOWTIMES
10750 IF MUS THEN MOUSE 1,TX+BXY,TY+BXY,1:GOTO *MOVEBOXMOUSE
10760 *MOVEBOXKEY
10770 'FOR Y=1 TO MAXY:GOSUB *CHECKPROGRAM:NEXT Y
10780 'LOCATE 5,5:PRINT USING "NowX =## NowY =##";NOWX;NOWY
10790 'LOCATE 5,6:PRINT USING "NextX=## NextY=##";NEXTX;NEXTY
10800 GOSUB *CLEARINKEY
10810 Q$="":WHILE Q$=""
10820 Q$=INKEY$:IF MODE=1 AND MTIME$<>TIME$ THEN GOSUB *SHOWTIMES
10830 WEND
10840 GOSUB *HITKEY 'RETURN,ESC
10850 GOSUB *INKEYXY
10860 GOSUB *MOVECHECKKEY
10870 GOSUB *CLEARCHECK 'FOR Y=1 TO MAXY:GOSUB *CHECKPROGRAM:NEXT Y
10880 GOTO *MOVEBOXKEY
10890 '
10900 *MOVEBOXMOUSE
10910 'LOCATE 5,3:PRINT USING "TmpX =## TmpY =##";TMPX;TMPY
10920 'LOCATE 5,4:PRINT USING "NowX =## NowY =##";NOWX;NOWY
10930 'LOCATE 5,5:PRINT USING "NextX=## NextY=##";NEXTX;NEXTY
10940 IF MODE=1 AND MTIME$<>TIME$ THEN GOSUB *SHOWTIMES
10950 GOSUB *CLEARINKEY
10960 'GAME=TRUE 'ゲーム中
10970 GOSUB *CLICKWAIT
10980 'GAME=FALSE
10990 IF Q$<>"" THEN GOSUB *HITKEY:GOTO *MOVEBOXMOUSE 'RETURN,ESC
11000 GOSUB *MOVECHECKMOUSE
11010 GOSUB *CLEARCHECK
11020 GOTO *MOVEBOXMOUSE
11030 '
11040 *EDITTING
11050 MOUSE 0 :MOUSE 1,,,1
11060 RET=FALSE
11070 COL=1:BCOL=0
11080 TX=270:TY=50:SETX=269+BXY:SETY=49+BXY
11090 LINE(SETX,SETY)-(SETX+12*BXY+1,SETY+16*BXY+1),PSET,%15,B
11100 *EDITLOOP
11110 LOCATE 5,5:PRINT USING "Col= &&";HEX$(COL)
11120 LOCATE 5,6:PRINT USING "MX=##### MY=#####";MX;MY
11130 IF NOT MOUSE(2,0) THEN FOR Y=1 TO 16: GOSUB *CHECKPROGRAM: NEXT Y
11140 GOSUB *CLICKWAIT ' IF NOT M THEN MUS=TRUE :GOSUB *WAITMOUSEOFF
11150 IF Q$="P" OR Q$="p" OR Q$="F" OR Q$="f" THEN GOSUB *E_PAINT
11160 IF Q$<>"" THEN GOSUB *HITKEY
11170 TMP=(MOUSE(0)-BXY/2)/BXY
11180 IF MOUSE(0)<BXY*16 AND MOUSE(1)<BXY AND COL<>TMP THEN BCOL=TMP :SWAP COL,BCOL
11190 IF COL=-1 THEN COL=0
11200 IF RET=TRUE THEN SWAP COL,BCOL :RET=FALSE
11210 IF MX<1 OR MY<1 THEN GOTO *EDITLOOP
11220 '
11230 SETX=BXY*MX+TX: SETY=BXY*MY+TY :OFSET=BYTE2*COL :BOX(MX,MY)=COL
11240 MOUSE 1,,,0
11250 PUT@A (SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
11260 MOUSE 1,,,1
11270 GOTO *EDITLOOP
11280 '
11290 *E_PAINT
11300 FOR Y=1 TO 16
11310 FOR X=1 TO 12
11320 OFSET=BYTE2*COL:BOX(X,Y)=COL
11330 SETX=BXY*X+TX:SETY=BXY*Y+TY
11340 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
11350 NEXT X
11360 NEXT Y
11370 RETURN
11380 '
11390 END
11400 '*************************データ******************************
11410 '
11420 *MENDATA
11430 '012345123456789面
11440 'DATA F$,M$
11450 'DATA X,Y,STEPS,TIME
11460 'DATA 完成,未完成
11470 *EASY
11480 'Easy1面
11490 DATA "PTN32","左が完成図です"
11500 DATA 3,3,60,20
11510 DATA 3BB,BBB
11520 DATA B0B,B0B
11530 DATA BBB,BB3
11540 '2面
11550 DATA "PTN32","もう少し、練習!"
11560 DATA 3,3,30,50
11570 DATA B33,BB3
11580 DATA B03,B03
11590 DATA BB3,B33
11600 '3面
11610 DATA "PTN32","ぐるぐるまわすと・・・ほらできた!"
11620 DATA 3,3,20,30
11630 DATA 565,655
11640 DATA 606,606
11650 DATA 565,565
11660 'Easy4面
11670 DATA "PTN32","ぐるぐる・・・パ-ト2"
11680 DATA 3,3,60,30
11690 DATA 565,656
11700 DATA 606,505
11710 DATA 565,656
11720 '5面
11730 DATA "PTN32","最後だ!"
11740 DATA 4,3,160,50
11750 DATA 9999,0666
11760 DATA 0666,EEEE
11770 DATA EEEE,9999
11780 '
11790 *NORMAL
11800 '1面
11810 DATA "PTN24","いれかえ その1 簡単だよね。"
11820 DATA 4,4,90,40
11830 DATA 0EE3,EEEE
11840 DATA EEEE,E33E
11850 DATA EEEE,E30E
11860 DATA 3EE3,EEEE
11870 '2面
11880 DATA "PTN24","ぐるぐるまわしていれば・・・なんとかなりそう。"
11890 DATA 4,4,240,120
11900 DATA 0DAA,3377
11910 DATA DDAA,3377
11920 DATA 7733,AADD
11930 DATA 7733,AAD0
11940 '3面
11950 DATA "PTN24","さっきと似ているけど違うョ"
11960 DATA 4,4,210,100
11970 DATA 0DAA,7733
11980 DATA DDAA,7733
11990 DATA 7733,DDAA
12000 DATA 7733,0DAA
12010 '4面
12020 DATA "PTN24","いれかえ その2 簡単過ぎましたね?"
12030 DATA 4,4,90,100
12040 DATA 0CC3,4CC4
12050 DATA C44C,C03C
12060 DATA C44C,C33C
12070 DATA 3CC3,4CC4
12080 '5面
12090 DATA "PTN24","市松模様だ!"
12100 DATA 4,4,120,40
12110 DATA 0888,0C8C
12120 DATA 8888,C8C8
12130 DATA CCCC,8C8C
12140 DATA CCCC,C8C8
12150 '
12160 *HARD
12170 '1面
12180 DATA "PTN24","ハ-ドは、こんなもんじゃないぞ。"
12190 DATA 4,4,160,80
12200 DATA 0333,9999
12210 DATA CCCC,BBBB
12220 DATA BBBB,CCCC
12230 DATA 9999,0333
12240 '2面
12250 DATA "PTN24","いれかえ その3 でも簡単です。"
12260 DATA 4,4,160,80
12270 DATA 066F,BBBF
12280 DATA 66FB,BBF6
12290 DATA 6FBB,BF66
12300 DATA FBBB,F660
12310 '3面
12320 DATA "PTN24","この入れ替えは、難しい。"
12330 DATA 5,5,160,160
12340 DATA 37773,A777A
12350 DATA 73A37,73337
12360 DATA 7A0A7,73037
12370 DATA 73A37,73337
12380 DATA 37773,A777A
12390 '4面
12400 DATA "PTN24","市松模様、再び"
12410 DATA 4,4,90,60
12420 DATA 0C8C,0888
12430 DATA C8C8,8888
12440 DATA 8C8C,CCCC
12450 DATA C8C8,CCCC
12460 '5面
12470 DATA "PTN24","鏡の中のBOX"
12480 DATA 5,5,600,400
12490 DATA EBF6B,B6FBE
12500 DATA BF6B9,9B6FB
12510 DATA F6B9E,E9B6F
12520 DATA 6B0E2,2E0B6
12530 DATA B9E2F,F2E9B
12540 '
12550 *SETCOLOR
12560 DATA 0, 0, 0, 0, 0,127, 0,127, 0, 0,127,127
12570 DATA 127, 0, 0, 127, 0,127, 127,127, 0, 127,127,127
12580 DATA 64, 64, 64, 0, 0,255, 0,255, 0, 0,255,255
12590 DATA 255, 0, 0, 255, 0,255, 255,255, 0, 255,255,255
12600 '
12610 '**********************サブルーチン***************************
12620 '
12630 *GETGAMEN
12640 LINE(540,0)-(639,479),PSET,%8,BF
12650 SYMBOL(544,0), "Slide",1,2,%13,,,3
12660 SYMBOL(544,35)," Box",1,2,%13,,,3
12670 SYMBOL(544,74)," TYPE I ",1,1,%13,,,3
12680 SYMBOL(544,153)," Hi Score",1,1,%12,,,1
12690 SYMBOL(544,192),"Your Score",1,1,%14,,,1
12700 SYMBOL(544,230),"Limit",1,1,%10,,,0
12710 SYMBOL(544,303)," ESC/タイトルヘ",1,1,%11,,,1
12720 GET@A (0,0)-(639,479),GAMEN
12730 RETURN
12740 '
12750 *MENU
12760 CLS :GOSUB *FADE_OUT
12770 RESTORE *MENU
12780 FOR I=1 TO 8
12790 READ M$,C
12800 SYMBOL (I*60,80),M$,5,10,%C,,,2
12810 NEXT I
12820 DATA S,10,l,14,i,12,d,13,e,9,B,11,o,10,x,14
12830 SYMBOL (200,220),"TYPE I",3,3,%12,,,2
12840 SYMBOL (400,239),"Copyright(c) SAKE 1992-1993",1,1,%15
12850 '
12860 M1$="P/時間を気にしないパズルモード"
12870 M2$="T/時間をきそうタイムトライアル"
12880 L1$="E/やさしい":L2$="N/並み":L3$="H/難しい"
12890 '
12900 GOSUB *SETMODE :GOSUB *SETLV
12910 COLOR 3 :LOCATE 17,19:PRINT "return/ゲームスタート"
12920 COLOR 1 :LOCATE 47,19:PRINT "ESC/終了"
12930 '
12940 IF MUS THEN
12950 TMP=TRUE:MOUSE 1,320,270,1
12960 WHILE TMP
12970 GOSUB *CLICKXY
12980 IF Q$<>"" THEN
12990 GOSUB *MENUKEY
13000 ELSE
13010 IF MY=>284 AND MY<=302 THEN
13020 IF MX=>56 AND MX<=295 THEN MODE=0
13030 IF MX=>320 AND MX<=559 THEN MODE=1
13040 GOSUB *SETMODE
13050 ELSE IF MY=>322 AND MY<=340 THEN
13060 IF MX=>176 AND MX<=255 THEN LV=0
13070 IF MX=>280 AND MX<=327 THEN LV=1
13080 IF MX=>344 AND MX<=407 THEN LV=2
13090 GOSUB *SETLV
13100 ELSE IF MY=>360 AND MY<=378 THEN
13110 IF MX=>136 AND MX<=303 THEN TMP=FALSE:BEEP
13120 IF MX=>376 AND MX<=439 THEN BEEP:COLOR 9 :LOCATE 47,19:PRINT "ESC/終了":COLOR 7:END
13130 ENDIF
13140 ENDIF
13150 WEND
13160 ELSE IF NOT MUS THEN
13170 TMP=TRUE
13180 WHILE TMP
13190 GOSUB *INKEYWAIT
13200 GOSUB *MENUKEY
13210 WEND
13220 ENDIF
13230 COLOR 11 :LOCATE 17,19:PRINT "return/ゲームスタート":COLOR 7
13240 GOSUB *FADE_IN
13250 RETURN
13260 '
13270 *MENUKEY
13280 IF Q$="P" OR Q$="p" THEN MODE=0:GOSUB *SETMODE
13290 IF Q$="T" OR Q$="t" THEN MODE=1:GOSUB *SETMODE
13300 IF Q$="E" OR Q$="e" THEN LV=0 :GOSUB *SETLV
13310 IF Q$="N" OR Q$="n" THEN LV=1 :GOSUB *SETLV
13320 IF Q$="H" OR Q$="h" THEN LV=2 :GOSUB *SETLV
13330 IF ASC(Q$)=13 THEN TMP=FALSE:BEEP
13340 IF ASC(Q$)=27 THEN BEEP:COLOR 9 :LOCATE 47,19:PRINT "ESC/終了":END
13350 RETURN
13360 '
13370 *SETMODE
13380 IF MODE=0 THEN 'Puzzule
13390 COLOR 13:LOCATE 7,15 :PRINT M1$
13400 COLOR 5 :LOCATE 40,15:PRINT M2$
13410 ELSE IF MODE=1 THEN 'TimeTrial
13420 COLOR 5 :LOCATE 7,15 :PRINT M1$
13430 COLOR 13:LOCATE 40,15:PRINT M2$
13440 ENDIF
13450 RETURN
13460 '
13470 *SETLV
13480 IF LV=0 THEN 'Easy
13490 COLOR 12:LOCATE 22,17:PRINT L1$
13500 COLOR 4 :LOCATE 35,17:PRINT L2$
13510 COLOR 4 :LOCATE 43,17:PRINT L3$
13520 ELSE IF LV=1 THEN 'Normal
13530 COLOR 4 :LOCATE 22,17:PRINT L1$
13540 COLOR 12:LOCATE 35,17:PRINT L2$
13550 COLOR 4 :LOCATE 43,17:PRINT L3$
13560 ELSE IF LV=2 THEN 'Hard
13570 COLOR 4 :LOCATE 22,17:PRINT L1$
13580 COLOR 4 :LOCATE 35,17:PRINT L2$
13590 COLOR 12:LOCATE 43,17:PRINT L3$
13600 ENDIF
13610 RETURN
13620 '
13630 *GETTING
13640 IF F$=TMP$ THEN *PUTTING
13650 IF F$<>TMP$ THEN LOAD@ F$+".tif",(0,0):TMP$=F$
13660 BXY=VAL(RIGHT$(F$,2)):TMP$=F$
13670 BYTE2=INT((INT((BXY+7)/8)*BXY*4+4-1)/4)*2
13680 FOR I=0 TO 15
13690 GET@A (BXY*I,0)-(BXY*I+BXY-1,BXY-1),GETIMAGE,BYTE2*I
13700 NEXT I
13710 RETURN
13720 '
13730 *PUTTING
13740 FOR I=0 TO 15
13750 PUT@A (BXY*I,0)-(BXY*I+BXY-1,BXY-1),GETIMAGE,PSET,,,,BYTE2*I
13760 NEXT I
13770 RETURN
13780 '
13790 *USEMOUSE
13800 LOCATE 15,11
13810 PRINT "・マウスを使う時は、クリックしてください。"
13820 LOCATE 15,13
13830 PRINT "・キーで操作する時は、何かキーを押してください。"
13840 Q$="" :M=TRUE
13850 MOUSE 0:MOUSE 1,,,0
13860 WHILE Q$="" AND M
13870 Q$=INKEY$
13880 'P=(PTRG(1)=0)
13890 M=(MOUSE(2,0)=0 AND MOUSE(2,1)=0)
13900 WEND
13910 IF NOT M THEN MUS=TRUE :GOSUB *WAITMOUSEOFF
13920 IF Q$<>"" THEN MUS=FALSE
13930 CLS
13940 IF NOT MUS THEN PRINT "You use key.":MOUSE 5
13950 RESTORE *USEMOUSE
13960 MAND$="":MDOT$=""
13970 FOR I=1 TO 32
13980 READ N :MAND$=MAND$+CHR$(N)
13990 NEXT I
14000 FOR I=1 TO 32
14010 READ N :MDOT$=MDOT$+CHR$(N)
14020 NEXT I
14030 '
14040 DATA &H3F,&HFF,&H1F,&HFF,&H0F,&HFF,&H07,&HFF
14050 DATA &H03,&HFF,&H01,&HFF,&H00,&HFF,&H00,&H7F
14060 DATA &H00,&H3F,&H00,&H1F,&H00,&H1F,&H00,&H7F
14070 DATA &H00,&H1F,&H00,&H1F,&H18,&H1F,&HFC,&H1F
14080 '
14090 DATA &H00,&H00,&H40,&H00,&H60,&H00,&H70,&H00
14100 DATA &H38,&H00,&H5C,&H00,&H3E,&H00,&H5F,&H00
14110 DATA &H2F,&H80,&H57,&HC0,&H2F,&H00,&H5B,&H00
14120 DATA &H25,&H80,&H42,&HC0,&H01,&HC0,&H00,&H00
14130 '
14140 IF MUS THEN PRINT "You use mouse." :MOUSE 2,MAND$,MDOT$,0,0
14150 RETURN
14160 '
14170 *READING
14180 'RESTORE *MENDATA
14190 IF LV=0 THEN RESTORE *EASY
14200 IF LV=1 THEN RESTORE *NORMAL
14210 IF LV=2 THEN RESTORE *HARD
14220 IF MEN=1 THEN RETURN
14230 FOR I=1 TO MEN-1
14240 READ F$,M$: TMP$=F$ : READ MAXX,MAXY,LIMSTEPS,LIMTIME
14250 FOR J=1 TO MAXY
14260 READ MEN$:READ MEN$
14270 NEXT J
14280 NEXT I
14290 RETURN
14300 '
14310 *SHOW
14320 CLS 1
14330 READ F$
14340 GOSUB *GETTING '前と違う時ロードし、同じ時は画面クリア
14350 COLOR ,,,0
14360 READ M$ :LOCATE 5,23 :IF MODE=0 THEN PRINT M$
14370 COLOR ,,,4
14380 READ MAXX,MAXY,LIMSTEPS,LIMTIME
14390 LEFTSTEPS=LIMSTEPS :LEFTTIME=LIMTIME+1
14400 IF MODE=1 THEN TOTAL=TOTAL-1
14410 PUT@A (0,0)-(639,479),GAMEN,PSET
14420 IF MODE=0 THEN Q$="Puzzle Mode" ELSE Q$="Time Trial"
14430 LOCATE 68,5 :PRINT Q$
14440 IF LV=0 THEN Q$="Easy" ELSE IF LV=1 THEN Q$="Normal" ELSE Q$="Hard"
14450 LOCATE 71,6 :PRINT Q$
14460 LOCATE 68,7 :PRINT USING " STAGE ###";MEN
14470 COLOR 4 :LOCATE 72,9 :PRINT USING "#######";HS&(MODE,LV)
14480 COLOR 6 :LOCATE 72,11:PRINT USING "#######";SC&
14490 COLOR 7
14500 COLOR 2:LOCATE 72,13
14510 IF MODE=0 THEN PRINT USING "/####";LIMSTEPS
14520 IF MODE=1 THEN PRINT USING "/####";LIMTIME
14530 LOCATE 74,14
14540 IF MODE=0 THEN PRINT "Steps"
14550 IF MODE=1 THEN PRINT " Sec"
14560 TMPX=0 :NOWX=0 :TMPY=0 :NOWY=0 'For MODE=0
14570 IF MODE=0 THEN GOSUB *SHOWSTEPS
14580 IF MODE=1 THEN GOSUB *SHOWTIMES
14590 COLOR 7
14600 '画面中央付近に表示するようにする。
14610 TX=270+BXY/2 : CTX=TX-BXY*(MAXX+3)
14620 TY=(480-BXY*(MAXY+2))/2 : CTY=TY
14630 'PRINT USING " TX=### TY=### CTX=### CTY=###";TX,TY,CTX,CTY
14640 FOR Y=1 TO MAXY
14650 READ MEN$
14660 FOR X=1 TO MAXX
14670 CBOX(X,Y)=VAL("&H"+MID$(MEN$,X,1)): BOX(X,Y)=CBOX(X,Y)
14680 IF CBOX(X,Y)=0 THEN CX=X:CY=Y:NOWX=X:NOWY=Y:NEXTX=X:NEXTY=Y
14690 SETX=BXY*X+CTX: SETY=BXY*Y+CTY:OFSET=BYTE2*CBOX(X,Y)
14700 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
14710 SETX=BXY*X+TX :SETY=BXY*Y+TY :OFSET=BYTE2*CBOX(X,Y)
14720 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
14730 NEXT X
14740 READ MEN$
14750 FOR X=1 TO MAXX
14760 IF MODE=0 THEN BOX(X,Y)=VAL("&H"+MID$(MEN$,X,1))
14770 NEXT X
14780 NEXT Y
14790 GOSUB *FADE_OUT
14800 IF MODE=0 THEN GOSUB *MODE0 'PuzzleMode
14810 IF MODE=1 THEN GOSUB *MODE1 'TimeTrialMode
14820 IF NOT MUS THEN GOSUB *WAY
14830 RETURN
14840 '
14850 *MODE0
14860 FOR Y=1 TO MAXY
14870 FOR X=1 TO MAXX
14880 IF BOX(X,Y)=0 THEN NOWX=X:NOWY=Y :NEXTX=X:NEXTY=Y :TMPX=X:TMPY=Y
14890 SETX=BXY*X+TX :SETY=BXY*Y+TY :OFSET=BYTE2*BOX(X,Y)
14900 PUT@A (SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
14910 IF BOX(X,Y)<>CBOX(X,Y) THEN FOR J=0 TO 3000/MAXX :NEXT J:BEEP
14920 NEXT X
14930 NEXT Y
14940 RETURN
14950 '
14960 *MODE1 'SHUFFLE
14970 FOR I=1 TO MAXX*MAXY 'シャッフル
14980 X=INT(RND*MAXX)+1: XX=INT(RND*MAXX)+1
14990 Y=INT(RND*MAXY)+1: YY=INT(RND*MAXY)+1
15000 SETX=BXY*X+TX: SETY=BXY*Y+TY :OFSET=BYTE2*BOX(XX,YY)
15010 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
15020 SETX=BXY*XX+TX:SETY=BXY*YY+TY :OFSET=BYTE2*BOX(X,Y)
15030 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
15040 SWAP BOX(X,Y),BOX(XX,YY)
15050 IF BOX(X,Y)=0 THEN NOWX=X:NOWY=Y:NEXTX=X:NEXTY=Y:TMPX=X:TMPY=Y
15060 IF BOX(XX,YY)=0 THEN NOWX=XX:NOWY=YY:NEXTX=XX:NEXTY=YY:TMPX=XX:TMPY=YY
15070 IF BOX(X,Y)<>BOX(XX,YY) THEN FOR J=1 TO 3000/MAXX:NEXT J:BEEP
15080 NEXT I
15090 RETURN
15100 '
15110 *SHOWSTEPS 'MODE=0
15120 TMP=ABS(TMPX-NOWX)+ABS(TMPY-NOWY)
15130 LEFTSTEPS=LEFTSTEPS-TMP
15140 IF LEFTSTEPS<0 THEN LEFTSTEPS=0
15150 COLOR 2:LOCATE 68,13 :PRINT USING "####";LEFTSTEPS
15160 COLOR 7
15170 'IF LV<>0 AND LEFTSTEPS<=0 THEN GAME=FALSE:GOSUB *STEPSOVER
15180 RETURN
15190 '
15200 *SHOWTIMES 'MODE=1
15210 LEFTTIME=LEFTTIME-1
15220 IF LEFTTIME<0 THEN LEFTTIME=0
15230 MTIME$=TIME$
15240 COLOR 2:LOCATE 68,13 :PRINT USING "####";LEFTTIME
15250 COLOR 7
15260 IF LEFTTIME<=5 THEN BEEP
15270 IF LEFTTIME<=0 THEN GOSUB *TIMEUP
15280 'IF LEFTTIME<=0 THEN GAME=FALSE:GOSUB *TIMEUP
15290 RETURN
15300 '
15310 *MOVECHECKKEY
15320 IF XX=1 AND NOWX>1 THEN NEXTX=NOWX-1 :GOSUB *MOVING
15330 IF XX=-1 AND NOWX<MAXX THEN NEXTX=NOWX+1:GOSUB *MOVING
15340 IF YY=1 AND NOWY>1 THEN NEXTY=NOWY-1 :GOSUB *MOVING
15350 IF YY=-1 AND NOWY<MAXY THEN NEXTY=NOWY+1:GOSUB *MOVING
15360 ' LOCATE 5,6:PRINT USING "NextX=## NextY=##";NEXTX;NEXTY
15370 RETURN
15380 '
15390 *MOVECHECKMOUSE
15400 IF RET THEN NEXTX=TMPX : NEXTY=TMPY :GOSUB *MOVING :RETURN
15410 IF MX<1 OR MAXX<MX THEN RETURN
15420 IF MY<1 OR MAXY<MY THEN RETURN
15430 IF MX=NOWX AND MY=NOWY THEN RETURN
15440 IF MX<>NOWX AND MY<>NOWY THEN RETURN
15450 NEXTX=MX : NEXTY=MY
15460 XX=NOWX-NEXTX :YY=NOWY-NEXTY :TMP=ST
15470 'IF RET THEN NEXTX=TMPX : NEXTY=TMPY :GOSUB *MOVING
15480 IF MX=NOWX THEN MY=NEXTY: GOSUB *MOVING :RETURN
15490 IF MY=NOWY THEN MX=NEXTX: GOSUB *MOVING
15500 RETURN
15510 '
15520 *CLEARCHECK
15530 IF NOWX<>CX OR NOWY<>CY THEN RETURN
15540 MENCLEAR=TRUE
15550 X=1:Y=1
15560 WHILE MENCLEAR AND Y<=MAXY
15570 IF BOX(X,Y)<>CBOX(X,Y) THEN MENCLEAR=FALSE
15580 X=X+1
15590 IF X>MAXX THEN Y=Y+1:X=1
15600 WEND
15610 IF NOT MENCLEAR THEN RETURN
15620 GOSUB *MENCLEAR
15630 IF MEN=LASTMEN THEN GOSUB *ALLCLEAR1:RETURN *TITLE
15640 MEN=MEN+1
15650 RETURN *MAIN
15660 '
15670 *MOVING
15680 IF MUS THEN MOUSE 1,,,0
15690 ' LOCATE 35,5:PRINT USING "XX=## YY=##";XX;YY
15700 ' LOCATE 48,5
15710 ' IF XX>0 THEN PRINT "→" ELSE IF XX<0 THEN PRINT "←"
15720 ' IF YY>0 THEN PRINT "↓" ELSE IF YY<0 THEN PRINT "↑"
15730 TMPY=NOWY : TMPX=NOWX
15740 IF NEXTY=NOWY AND NOWX<NEXTX THEN GOSUB *MOVING1:'PRINT "→"
15750 IF NEXTY=NOWY AND NOWX>NEXTX THEN GOSUB *MOVING2:'PRINT "←"
15760 IF NEXTX=NOWX AND NOWY<NEXTY THEN GOSUB *MOVING3:'PRINT "↓"
15770 IF NEXTX=NOWX AND NOWY>NEXTY THEN GOSUB *MOVING4:'PRINT "↑"
15780 BOX(NEXTX,NEXTY)=0
15790 NOWX=NEXTX : NOWY=NEXTY
15800 IF MODE=0 THEN GOSUB *SHOWSTEPS
15810 IF MUS THEN MOUSE 1,,,1
15820 RETURN
15830 '
15840 *MOVING1
15850 FOR I=BXY-ST TO 0 STEP -ST
15860 SETY=TY+BXY*NEXTY
15870 FOR J=NEXTX TO NOWX+1 STEP -1
15880 SETX = TX + BXY * (J-1) + I
15890 OFSET = BYTE2 * BOX(J,NEXTY)
15900 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
15910 NEXT J
15920 SETX=TX+BXY*NEXTX+I
15930 FOR K=ST -1 TO 0 STEP -1
15940 LINE(SETX+K,SETY)-(SETX+K,SETY+BXY-1),PSET,%0
15950 NEXT K
15960 NEXT I
15970 FOR I=NOWX TO NEXTX -1
15980 BOX(I,NEXTY)=BOX(I+1,NEXTY)
15990 NEXT I
16000 RETURN
16010 '
16020 *MOVING2
16030 FOR I=ST TO BXY STEP ST
16040 SETY=TY+BXY*NEXTY
16050 FOR J=NEXTX TO NOWX -1 STEP 1
16060 SETX=TX+BXY*J+I
16070 OFSET=BYTE2*BOX(J,NEXTY)
16080 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
16090 NEXT J
16100 SETX=TX+BXY*NEXTX+I-ST
16110 FOR K=0 TO ST-1 STEP 1
16120 LINE(SETX+K,SETY)-(SETX+K,SETY+BXY-1),PSET,%0
16130 NEXT K
16140 NEXT I
16150 FOR I=NOWX TO NEXTX+1 STEP -1
16160 BOX(I,NEXTY)=BOX(I-1,NEXTY)
16170 NEXT I
16180 RETURN
16190 '
16200 *MOVING3
16210 FOR I=BXY-ST TO 0 STEP -ST
16220 SETX=TX+BXY*NEXTX
16230 FOR J=NEXTY TO NOWY+1 STEP -1
16240 SETY = TY + BXY* (J-1) + I
16250 OFSET = BYTE2 * BOX(NEXTX,J)
16260 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
16270 NEXT J
16280 SETY=TY+BXY*NEXTY+I
16290 FOR K=ST -1 TO 0 STEP -1
16300 LINE(SETX,SETY+K)-(SETX+BXY-1,SETY+K),PSET,%0
16310 NEXT K
16320 NEXT I
16330 FOR I=NOWY TO NEXTY -1
16340 BOX(NEXTX,I)=BOX(NEXTX,I+1)
16350 NEXT I
16360 RETURN
16370 '
16380 *MOVING4
16390 FOR I=ST TO BXY STEP ST
16400 SETX=TX+BXY*NEXTX
16410 FOR J=NEXTY TO NOWY-1 STEP 1
16420 SETY=TY+BXY*J+I
16430 OFSET=BYTE2*BOX(NEXTX,J)
16440 PUT@A(SETX,SETY)-(SETX+BXY-1,SETY+BXY-1),GETIMAGE,PSET,,,,OFSET
16450 NEXT J
16460 SETY=TY+BXY*NEXTY+I-ST
16470 FOR K=0 TO ST-1 STEP 1
16480 LINE(SETX,SETY+K)-(SETX+BXY-1,SETY+K),PSET,%0
16490 NEXT K
16500 NEXT I
16510 FOR I=NOWY TO NEXTY+1 STEP -1
16520 BOX(NEXTX,I)=BOX(NEXTX,I-1)
16530 NEXT I
16540 RETURN
16550 '
16560 '*STEPSOVER
16570 ' SYMBOL (0,100),"STEPS OVER!",7,10,%10,,,4
16580 ' RETURN *GAMEOVER
16590 '
16600 *TIMEUP
16610 SYMBOL (0,100),"TIME OVER!",7,10,%10,,,4
16620 RETURN *GAMEOVER
16630 '
16640 *GAMEOVER
16650 IF MUS THEN
16660 LOCATE 5,19:PRINT "コンティニューする時は、";
16670 PRINT "マウスの左ボタンを押してください。"
16680 LOCATE 5,21:PRINT "タイトルに戻る時は、";
16690 PRINT "マウスの右ボタンを押してください。"
16700 LOCATE 5,23:PRINT "ゲーム自体を止める時は、";
16710 PRINT "ESCキーを押してください。"
16720 Q$="" : M=TRUE
16730 WHILE Q$="" AND M
16740 IF MOUSE(2,0) OR MOUSE(2,1) THEN M=FALSE
16750 Q$=INKEY$
16760 WEND
16770 IF Q$<>"" THEN
16780 IF ASC(Q$)=27 THEN END ELSE GOTO *GAMEOVER
16790 ENDIF
16800 IF MOUSE(2,0)=TRUE THEN
16810 GOSUB *GOMAIN
16820 ELSE IF MOUSE(2,1)=TRUE THEN
16830 GOSUB *GOTITLE
16840 ENDIF
16850 '
16860 ELSE IF NOT MUS THEN
16870 LOCATE 5,19:PRINT "コンティニューする時は、";
16880 PRINT "Yキーまたは、RETURNキーを押してください。"
16890 LOCATE 5,21:PRINT "タイトルに戻る時は、";
16900 PRINT "Nキーまたは、SPACEキーを押してください。"
16910 LOCATE 5,23:PRINT "ゲーム自体を止める時は、";
16920 PRINT "ESCキーを押してください。"
16930 Q$=""
16940 WHILE Q$=""
16950 Q$=INKEY$
16960 WEND
16970 IF Q$="Y" OR Q$="y" OR ASC(Q$)=13 THEN
16980 GOSUB *GOMAIN
16990 ELSE IF Q$="N" OR Q$="n" OR Q$=" " THEN
17000 GOSUB *GOTITLE
17010 ELSE IF ASC(Q$)=27 THEN
17020 END
17030 ENDIF
17040 ENDIF
17050 '
17060 *GOMAIN
17070 SC&=0
17080 GOSUB *FADE_IN
17090 CLS
17100 RETURN *MAIN
17110 '
17120 *GOTITLE
17130 GOSUB *FADE_IN
17140 CLS
17150 RETURN *TITLE
17160 '
17170 *MENCLEAR
17180 IF MUS THEN MOUSE 1,,0
17190 WAIT 50
17200 LINE(220,180)-(330,300),PSET,%8,BF
17210 LINE(200,160)-(310,280),PSET,%7,BF
17220 Q$="STAGE "+STR$(MEN)
17230 SYMBOL (226,164),Q$,1,2,%12,,,1
17240 SYMBOL (226,204)," Clear!",1,2,%12,,,1
17250 SYMBOL (226,244),"-score-",1,1,%14,,,1
17260 IF MODE=0 THEN J=LEFTSTEPS ELSE J=LEFTTIME
17270 TMP=5
17280 FOR I=1 TO 5
17290 IF SC&=>10^I THEN TMP=5-I
17300 NEXT I
17310 Q$=STRING$(TMP," ")+STR$(J*(LV+1)*10)
17320 SYMBOL (226,264),Q$,1,1,%14,,,1
17330 WAIT 80
17340 K=J
17350 IF J>0 THEN
17360 FOR I=1 TO J
17370 K=K-1:BEEP
17380 SC&=SC&+(LV+1)*10
17390 IF HS&(MODE,LV)<SC& THEN HS&(MODE,LV)=SC&
17400 LOCATE 68,13 :COLOR 2 :PRINT USING "####";K
17410 LOCATE 72,9 :COLOR 4 :PRINT USING "#######";HS&(MODE,LV)
17420 LOCATE 72,11 :COLOR 6 :PRINT USING "#######";SC&
17430 WAIT 3
17440 NEXT I
17450 ENDIF
17460 IF NOT MEN=LASTMEN THEN COLOR 7:GOSUB *FADE_IN:IF MUS THEN MOUSE 1,,1
17470 RETURN
17480 '
17490 *ALLCLEAR1
17500 CLS 1 'TXT
17510 IF MUS THEN MOUSE 1,,0
17520 FOR I=1 TO 10
17530 LINE(320-32*I,240-24*I)-(320+32*I,240+24*I),PSET,%15,BF
17540 WAIT 5
17550 NEXT I
17560 FOR I=1 TO 10
17570 LINE(320-32*I,240-24*I)-(320+32*I,240+24*I),PSET,%0,BF
17580 WAIT 5
17590 NEXT I
17600 FOR I=1 TO 10
17610 LINE(320-32*I,240-24*I)-(320+32*I,240+24*I),PSET,%15,BF
17620 WAIT 5
17630 NEXT I
17640 FOR I=1 TO 6
17650 LINE(320-32*I,240-4*I)-(320+32*I,240+4*I),PSET,%0,BF
17660 WAIT 5
17670 NEXT I
17680 RESTORE *ALLCLEAR1
17690 FOR I=1 TO 8
17700 READ M$,C
17710 SYMBOL (I*60,60),M$,5,10,%C,,,7
17720 NEXT I
17730 DATA "S",10,"l",14,"i",12,"d",13,"e",9,"B",11,"o",10,"x",14
17740 IF LV=0 THEN
17750 M$=" Easy "
17760 ELSE IF LV=1 THEN
17770 M$="Normal"
17780 ELSE IF LV=2 THEN
17790 M$=" Hard "
17800 ENDIF
17810 SYMBOL (80,320),M$,5,5,%9,,,5
17820 Q$=" Hi Score :"+STR$(HS&(MODE,LV))
17830 SYMBOL (250,280),Q$,1,1,%12,,,5
17840 Q$="Your Score :"+STR$(SC&)
17850 SYMBOL (250,300),Q$,1,1,%14,,,5
17860 TMP=TRUE:Q$="":COLOR ,,,4
17870 WHILE TMP
17880 COLOR INT(RND*7+1)
17890 LOCATE 24,12:PRINT "Congratulations!"
17900 IF MUS THEN
17910 IF MOUSE(2,0) OR MOUSE(2,1) THEN TMP=FALSE
17920 ELSE
17930 Q$=INKEY$:IF Q$<>"" THEN TMP=FALSE
17940 ENDIF
17950 WEND
17960 RETURN
17970 '
17980 *FADE_IN
17990 FOR I=15 TO 0 STEP -1
18000 FOR J=1 TO 15
18010 PALETTE J,[G(J)*I/15,R(J)*I/15,B(J)*I/15]
18020 NEXT J
18030 WAIT 10
18040 NEXT I
18050 RETURN
18060 '
18070 *FADE_OUT
18080 FOR I=0 TO 15
18090 FOR J=1 TO 15
18100 PALETTE J,[G(J)*I/15,R(J)*I/15,B(J)*I/15]
18110 NEXT J
18120 WAIT 8
18130 NEXT I
18140 RETURN
18150 '
18160 *CHECKPROGRAM
18170 LOCATE 0,6+Y
18180 FOR X=1 TO 12 :PRINT USING "&&";HEX$(BOX(X,Y));:NEXT X
18190 RETURN
18200 '
18210 *HITKEY
18220 IF (NOT MUS) AND ASC(Q$)=13 THEN MOVE=-MOVE:GOSUB *WAY
18230 IF ASC(Q$)=27 THEN RETURN *TITLE 'END
18240 RETURN
18250 '
18260 *WAY
18270 IF MOVE=1 THEN
18280 LOCATE 71,20:PRINT " ↑ "
18290 LOCATE 71,21:PRINT "← →"
18300 LOCATE 71,22:PRINT " ↓ "
18310 ELSE IF MOVE=-1 THEN
18320 LOCATE 71,20:PRINT " ↓ "
18330 LOCATE 71,21:PRINT "→ ←"
18340 LOCATE 71,22:PRINT " ↑ "
18350 ENDIF
18360 LOCATE 70,19:PRINT "キー操作"
18370 LOCATE 68,23:PRINT "return=変更"
18380 RETURN
18390 '
18400 '********************汎用サブルーチン*************************
18410 *INKEYWAIT
18420 Q$=INPUT$(1)
18430 'WHILE Q$="":Q$=INKEY$:WEND
18440 RETURN
18450 '
18460 *INKEYXY
18470 XX=0:YY=0
18480 IF Q$="2" OR ASC(Q$)=31 THEN YY=1
18490 IF Q$="4" OR ASC(Q$)=29 THEN XX=-1
18500 IF Q$="6" OR ASC(Q$)=28 THEN XX=1
18510 IF Q$="8" OR ASC(Q$)=30 THEN YY=-1
18520 XX=XX*MOVE : YY=YY*MOVE
18530 RETURN
18540 '
18550 *CLEARINKEY
18560 WHILE INKEY$<>"" AND PAD(1)=0 :WEND
18570 RETURN
18580 '
18590 *CLICKWAIT
18600 Q$="" : M=TRUE : RET=FALSE
18610 WHILE Q$="" AND M
18620 Q$=INKEY$
18630 M=(MOUSE(2,0)=0 AND MOUSE(2,1)=0)
18640 MX=(MOUSE(0)-TX-BXY/2)/BXY: MY=(MOUSE(1)-TY-BXY/2)/BXY
18650 'LOCATE 5,2:PRINT USING "Mcol=###";(MOUSE(0)-BXY/2)/BXY
18660 'LOCATE 5,6:PRINT USING "MX=##### MY=#####";MX;MY
18670 IF MODE=1 AND MTIME$<>TIME$ THEN GOSUB *SHOWTIMES
18680 WEND
18690 IF Q$<>"" THEN RETURN
18700 M=TRUE :IF MOUSE(2,1)=-1 THEN RET=TRUE 'Right Click
18710 IF MODE THEN RETURN
18720 WHILE M
18730 M=(MOUSE(2,0)=-1 OR MOUSE(2,1)=-1)
18740 MX=(MOUSE(0)-TX-BXY/2)/BXY: MY=(MOUSE(1)-TY-BXY/2)/BXY
18750 'LOCATE 5,2:PRINT USING "Mcol=###";(MOUSE(0)-BXY/2)/BXY
18760 'LOCATE 5,6:PRINT USING "MX=##### MY=#####";MX;MY
18770 IF MODE=1 AND MTIME$<>TIME$ THEN GOSUB *SHOWTIMES
18780 WEND
18790 RETURN
18800 '
18810 *WAITMOUSEOFF
18820 WHILE (MOUSE(2,0) OR MOUSE(2,1)):WEND
18830 RETURN
18840 '
18850 *CLICKXY
18860 Q$="":M=TRUE:COLOR 7
18870 WHILE Q$="" AND M
18880 Q$=INKEY$
18890 M=(MOUSE(2,0)=0 AND MOUSE(2,1)=0)
18900 'LOCATE 5,2 :PRINT USING "MX=### MY=###";MOUSE(0);MOUSE(1)
18910 WEND
18920 IF Q$<>"" THEN RETURN
18930 GOSUB *WAITMOUSEOFF
18940 MX=MOUSE(0):MY=MOUSE(1)
18950 RETURN